{{- $summary := .Summary | truncate 160 }}
{{- with .Params.description }}
  {{- $summary = (. | truncate 160) }}
{{- end }}
{{- $site := .Site.Title }}
{{- $title := .Title }}
{{- $params := .Site.Params }}
{{- $permalink := .Permalink }}
{{- $logo := absURL (printf "images/%s" $params.logo) }}
{{- $image := absURL (printf "images/%s" $params.image) }}
{{- $author := $params.author }}
{{- with .Params.author }}
  {{ $author := . }}
{{- end }}
{{- with .Params.image }}
  {{- $image = absURL (printf "images/%s" .)  }}
{{- end }}
<meta property = 'og:locale' content = 'en_US' />
{{- if .IsHome }}
<meta property="og:type" content="website">
{{- else }}
<meta property="og:type" content="article">
{{- end }}
<meta property = 'og:title' content = '{{ $title }}' />
<meta name="description" content="{{ $summary }}">
<meta property = 'og:description' content = '{{ $summary }}'>
<meta property = 'og:url' content = '{{ $permalink }}' />
<meta property = 'og:image' content = '{{ $image }}'/>
<meta name = 'twitter:card' content = 'summary_large_image' />
<meta name = 'twitter:creator' content = '{{ $params.twitter }}'>
<meta name = 'twitter:title' content = '{{ .Title }}' />
<meta property = 'twitter:description'  content = '{{ $summary }}'/>
<meta name = 'twitter:image' content = '{{ $image }}' />
{{- if eq .Section "blog" -}}
  {{- $date := ( .Date.Format "2006-02-01") -}}
  {{- $date := (time .Date) }}
  {{- $lastMod := (time .Lastmod) }}
  <script type = "application/ld+json">
    {
      "@context": "http://schema.org",
      "@type": "BlogPosting",
      "mainEntityOfPage":"{{ $permalink }}",
      "name": "{{ $site }}",
      "headline": {{ $title }},
      "description": {{ $summary }},
      "url": "{{ $permalink }}",
      "datePublished": {{ $date  }},
      "dateModified": {{ $lastMod }},
      "author": {
        "@type": "Person",
        "name": "{{ $author }}"
      },
      "image":{
        "@type":"ImageObject",
        "url": "{{ $image }}"
      },
      "publisher": {
        "@type": "Organization",
        "logo": {
          "@type":"ImageObject",
          "url": "{{ $logo }}"
        },
        "name": "{{ $site }}"
      }
    }
  </script>
{{- end }}
